var Member_Join = function() {
    count = 0;
    isConfirmFirst = false;
    isConfirmSecond = false;
    join_this = this;
};

Member_Join.prototype = {
    constructor : Member_Join,

    setConfirmBtn : function() {
        console.log(isConfirmFirst + "::" + isConfirmSecond);
        
        // 첫번째 동의를 안하였을 때
        if(!isConfirmFirst) {
            alert("이용약관에 동의하여 주세요.");
            return;
        }
        
        // 두번째 동의를 안하였을 때
        if(!isConfirmSecond) {
            alert("개인정보 취급방침에 동의하여 주세요.");
            return;
        } 
        
        if (isConfirmFirst && isConfirmSecond) {
            $.mobile.changePage("join_01.html");
            // $("#btn_next").attr("href", "join_01.html");
        } else {
            // $("#btn_next").attr("href", "#");
        }
    },
    onPageShow : function() {      
        // console.log("join::joinPageInit");
        console.log(this);
        $('a').attr('href', '').attr("data-rel", "");
        // this.setConfirmBtn();
        isConfirmFirst = false;
        isConfirmSecond = false;
        $("input[type='radio']").attr("checked", false).checkboxradio("refresh");
        $("input#a1").on("change", function(event) {
            isConfirmFirst = true;
            // join_this.setConfirmBtn();
        });
        $("input#a2").on("change", function(event) {
            isConfirmFirst = false;
            // join_this.setConfirmBtn();
        });
        $("input#b1").on("change", function(event) {
            isConfirmSecond = true;
            // join_this.setConfirmBtn();
        });
        $("input#b2").on("change", function(event) {
            isConfirmSecond = false;
            // join_this.setConfirmBtn();
        });
        $("#btn_next").on("click", function(event) {
            console.log(isConfirmFirst + "," + isConfirmSecond);
            join_this.setConfirmBtn();
        });
        //이전        
        $("section#member_join header div.top_title_Gre div.top_left a.btn8").click(function(event){
            event.preventDefault();            
            $.mobile.changePage("../inc/navi.html","slide",true);	         
        });
        //이용약관보기
        $("section#member_join section form ul.join_form li:eq(0) p.bt_sub a").click(function(event){
            event.preventDefault();            
            $.mobile.changePage("pop_agree.html","slide",true);
        });
        //개인정보취급방침보기
        $("section#member_join section form ul.join_form li:eq(1) p.bt_sub a").click(function(event){
            event.preventDefault();            
            $.mobile.changePage("pop_privacy.html","slide",true);
        });
    }
}



